package com.dyw.ycgovfinance.mvp.base;

import android.support.v4.app.Fragment;
import android.view.View;

import com.dyw.ycgovfinance.widget.LoadingProgressDialog;

/**
 * Created by Administrator on 2017/6/20.
 */

public abstract class BaseFragment extends Fragment {

    public abstract void initData();

    public abstract void assignView(View view);

    public abstract void initView();


    LoadingProgressDialog progressDialog;

    public void showProgressDialog(boolean canBack, String loadingMsg) {
        if (progressDialog != null) {
            progressDialog.cancel();
        }

        progressDialog = new LoadingProgressDialog(getActivity(), loadingMsg);
        if (canBack) {
            progressDialog.setCancelable(true);
        } else {
            progressDialog.setCancelable(false);
        }
        progressDialog.show();
    }

    public void dismissProgressDialog() {
        if (null != progressDialog && progressDialog.isShowing()) {
            progressDialog.cancel();
        }
    }
}
